This vignette explains how you can host a problem set directly in the web using shinyapps.io.

You can create an app based on an .rps file or based on a problem set package hosted that is hosted on Github (see the corresponding vignette for how to create such a package)

1. Create an app based on an skeleton with rtutor.app.skel

The RTutor package has a function rtutor.app.skel that creates a skeleton of your app directory and a file deployapp.r which contains commands to deploy your app.

Here is an example fore creating an app based on an .rps file:

  # Create app based on .rps

  ps.name = "Example" # problem set name
  libs = c("foreign", "ggplot2") # list of all libraries used by ps
  # Folder that contains your .rps file
  rps.dir = "D:/libraries/RTutor/examples"
  # Folder in which app shall be created
  app.dir = "D:/libraries/RTutor/examples/ExampleApp"
  rtutor.app.skel(ps.name=ps.name, app.name="RTutorExample",
                  app.dir=app.dir, rps.dir = rps.dir,
                  rps.app = TRUE, libs=libs,overwrite=TRUE)

You must just adapt the names and directories in the example above.

2. Open deployapp.r and follow the described steps

Now in your app directory, e.g. "D:/libraries/RTutor/examples/ExampleApp" a file deployapp.r is created. Follow the steps described in this file to deploy your app on shinyapps.io. The file also contains the links that describe how to create a user account on shinyapps.io.

Security issues

RTutor problem sets allow the user to run arbitrary code. So unless you have really figured out security issues, I would definitely not recommend hosting shinyapps on your own shinyserver. (I personally have not figured out these security issues.) Since RStudio allows to run arbitrary apps on shinyapps.io, they probably have carefully sandboxed their app environment. Still, maliciously minded users may damage your app on shinyapps.io e.g. by deleting data. So deploying an app on shinyapps.io allows users to have a glimpse at your app, but it is not really useful as robust deployment, e.g. for use in a course. If you want to use RTutor in a course, users should locally install RTutor and the problem set (see the main vignette for deplyoment options).

Not recommended: create app based on an RTutor problemset package hosted on github

If you have created an github R package for your RTutor problem set, you could also create the app based on your package. However, uploading this app on shinyapps.io may not work if your github package contains data sets that are too larg. Therefore:

I would recommend to create your app based on an .rps file.

Nevertheless, here is an example, how you could create an app based on an github based RTutor problemset package .

  # Create app based on a problem set package
  ps.name = "Example"
  app.dir = "D:/libraries/RTutor/examples/ExampleApp"
  rtutor.app.skel(ps.name=ps.name, app.name="RTutorExample",app.dir=app.dir, 
                  pkg.name = "RTutorExample", rps.app = FALSE,
                  github.user = "skranz", overwrite=TRUE)


skranz/RTutor3 documentation built on May 30, 2019, 2:01 a.m.